|
|
@@ -19,7 +19,6 @@ import java.io.BufferedOutputStream;
|
19
|
19
|
import java.io.BufferedReader;
|
20
|
20
|
import java.io.DataOutputStream;
|
21
|
21
|
import java.io.File;
|
22
|
|
-import java.io.FileInputStream;
|
23
|
22
|
import java.io.FileOutputStream;
|
24
|
23
|
import java.io.IOException;
|
25
|
24
|
import java.io.InputStreamReader;
|
|
|
@@ -150,7 +149,7 @@ public class App extends Application{
|
150
|
149
|
|
151
|
150
|
String cmd = "chmod 777 " + getPackageCodePath();
|
152
|
151
|
String cmd2 = "chmod -R 0777 /dev/bus/usb" ;
|
153
|
|
- String cmd3 = "mount -o rw,remount "+getSystemBlockAddr()+" /system" ;
|
|
152
|
+ String cmd3 = "mount -o rw,remount "+getSystemBlockPath()+" /system" ;
|
154
|
153
|
String cmd5 = "cp -fr /mnt/sdcard/lensman/so/. /system/lib" ;
|
155
|
154
|
|
156
|
155
|
String cmd6 = "" ;
|
|
|
@@ -200,29 +199,27 @@ public class App extends Application{
|
200
|
199
|
|
201
|
200
|
}
|
202
|
201
|
|
203
|
|
- private String getSystemBlockAddr(){
|
|
202
|
+ private String getSystemBlockPath(){
|
204
|
203
|
String path = null;
|
205
|
204
|
Process process = null;
|
206
|
|
- DataOutputStream os = null;
|
|
205
|
+ BufferedReader in = null;
|
207
|
206
|
try {
|
208
|
|
- String cmd = "mount | grep /system >/mnt/sdcard/lensman/system_path.txt";
|
209
|
|
- process = Runtime.getRuntime().exec("su");
|
210
|
|
- os = new DataOutputStream(process.getOutputStream());
|
211
|
|
- os.writeBytes(cmd + "\n");
|
212
|
|
- os.writeBytes("exit\n");
|
213
|
|
- os.flush();
|
214
|
|
- process.waitFor();
|
215
|
|
- FileInputStream f=new FileInputStream("/mnt/sdcard/lensman/system_path.txt");
|
216
|
|
- BufferedReader tmp_reader=new BufferedReader(new InputStreamReader(f));
|
217
|
|
- String tmp=tmp_reader.readLine();
|
218
|
|
- path = tmp.substring(0,tmp.indexOf(" "));
|
219
|
|
- LogHelper.d("czy","/system asolute path is -->"+path);
|
|
207
|
+ String cmd = "mount";
|
|
208
|
+ process = Runtime.getRuntime().exec(cmd);
|
|
209
|
+ in = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
|
210
|
+ String line;
|
|
211
|
+ while ((line = in.readLine()) != null) {
|
|
212
|
+ if(line.contains(" /system")){
|
|
213
|
+ path = line.substring(0,line.indexOf(" /system"));
|
|
214
|
+ LogHelper.d("czy","process result ="+line+"\n+");
|
|
215
|
+ }
|
|
216
|
+ }
|
220
|
217
|
} catch (Exception e) {
|
221
|
218
|
LogHelper.d("czy","getSystemBlockAddr exception occur -->"+e);
|
222
|
219
|
} finally {
|
223
|
220
|
try {
|
224
|
|
- if (os != null) {
|
225
|
|
- os.close();
|
|
221
|
+ if(in!=null){
|
|
222
|
+ in.close();
|
226
|
223
|
}
|
227
|
224
|
process.destroy();
|
228
|
225
|
} catch (Exception e) {
|